home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / keyb / 256keys.zip / 256KEYS.ASM next >
Assembly Source File  |  1989-01-27  |  5KB  |  120 lines

  1. ;=============================================================================;
  2. ;+---------------------------------------------------------------------------+;
  3. ;|                                         |;
  4. ;|  256keys.asm  --  256 key typeahead buffer for IBM compatible BIOS.         |;
  5. ;|                                         |;
  6. ;|  Created by:     Eric A. Neulight              3417 Birch Circle  |;
  7. ;|  Creation Date:  July 8, 1987              Allentown, PA      |;
  8. ;|                                         |;
  9. ;|              (c) 1987    All Rights Reserved                 |;
  10. ;+---------------------------------------------------------------------------+;
  11. ;|                  Revision History                     |;
  12. ;|                                         |;
  13. ;|                   Revisions End                     |;
  14. ;+---------------------------------------------------------------------------+;
  15. ;| Notes:                                     |;
  16. ;|     1.  This module was created to be run as a .com file.             |;
  17. ;|        Be sure to run exe2bin after compiling and linking.          |;
  18. ;+---------------------------------------------------------------------------+;
  19. ;=============================================================================;
  20.         name    keys256
  21.  
  22. ;=============================================================================;
  23. KEYS256_CODE    segment word public 'CODE'
  24.         assume    cs:KEYS256_CODE
  25.  
  26. ;=============================================================================;
  27. ;-----------------------------------------------------------------------------;
  28. ;  This module installs a large typeahead buffer into BIOS, replacing          ;
  29. ;   BIOS' measly 16 key typeahead.  The only limitation of this is caused     ;
  30. ;   by BIOS itself, in that the newly allocated buffer must reside within     ;
  31. ;   the BIOS data area, i.e. segment 40h.                      ;
  32. ;                                          ;
  33. ;  The install module will ensure that the buffer lives within segment 40h.   ;
  34. ;   Most BIOS will allow this.    For the greatest chance of successful          ;
  35. ;   installation, and protection against corruption, run this as the first    ;
  36. ;   "terminate and stay resident" program upon booting.                       ;
  37. ;-----------------------------------------------------------------------------;
  38.  
  39. ;-----------------------------------------------------------------------------;
  40. ; .com module must have runnable code at 100h in code segment.              ;
  41. ;-----------------------------------------------------------------------------;
  42.         org    100h
  43. xinstall:    jmp    install
  44.  
  45. ;-----------------------------------------------------------------------------;
  46. ;  declaration for memory to hold 256 key typeahead fifo.              ;
  47. ;-----------------------------------------------------------------------------;
  48.         even
  49. key_buf     dw    256 dup (0)
  50.  
  51. protect:
  52.  
  53.  
  54. ;-----------------------------------------------------------------------------;
  55. ;  various messages used during installation.                      ;
  56. ;-----------------------------------------------------------------------------;
  57. resid$        db    0Dh,0Ah,'256 Key Buffer Is Now Installed',0Dh,0Ah,'$'
  58. nores$        db    0Dh,0Ah,'256 Key Buffer Is Already Installed',0Dh,0Ah,'$'
  59. nomem$        db    0Dh,0Ah,'Cannot Locate 256 Key Buffer At Segment 40h',0Dh,0Ah,'$'
  60.  
  61.  
  62. ;-----------------------------------------------------------------------------;
  63. ;  installation routine.
  64. ;-----------------------------------------------------------------------------;
  65. install:
  66.         mov    ax,40h
  67.         mov    ds,ax            ;address bios data area.
  68.         cmp    word ptr ds:[80h],1eh    ;already installed?
  69.         jnz    exit            ;jump if installed.
  70.  
  71.         mov    ax,cs            ;check addressability.
  72.         sub    ax,40h            ;must be able to locate
  73.         cmp    ax,0FE0h        ; within segment 0040h.
  74.         ja    exit1            ;jump if cannot locate.
  75.         mov    cl,4
  76.         shl    ax,cl
  77.         add    ax,offset key_buf
  78.         jc    exit1            ;jump if cannot locate.
  79.         cmp    ax,0FE00h        ;enough room for buffer?
  80.         ja    exit1            ;jump if cannot locate.
  81.  
  82.         cli                ;able to locate.
  83.         mov    ds:[1Ah],ax        ;install new fifo head ptr.
  84.         mov    ds:[1Ch],ax        ;install new fifo tail ptr.
  85.         mov    ds:[80h],ax        ;install new buf bottom ptr.
  86.         add    ax,256*2        ;calculate buffer top.
  87.         mov    ds:[82h],ax        ;install new buf top ptr.
  88.         sti
  89.  
  90.         mov    ah,9
  91.         mov    dx,cs
  92.         mov    ds,dx
  93.         mov    dx,offset resid$
  94.         int    21h            ;display success message.
  95.  
  96.         mov    dx,offset protect    ;terminate and stay resident
  97.         int    27h
  98.  
  99. exit:        mov    ah,9
  100.         mov    dx,cs
  101.         mov    ds,dx
  102.         mov    dx,offset nores$
  103.         int    21h            ;display already installed.
  104.         jmp    short termin
  105.  
  106. exit1:        mov    ah,9
  107.         mov    dx,cs
  108.         mov    ds,dx
  109.         mov    dx,offset nomem$
  110.         int    21h            ;display cannot locate.
  111.  
  112. termin:     mov    ax,4C00h
  113.         int    21h            ;terminate normally
  114.  
  115. ;=============================================================================;
  116. KEYS256_code    ends
  117.  
  118. ;=============================================================================;
  119.         end    xinstall
  120.